//az adatbazisban Corected attributuma van a Tasks tablanak. 
//azt atirtam Correctedre, mert ugy helyes. egyszeruen at tudjatok ti is irni. (bocsi, de ugy szurta a szemem :) )  

package matlap.server;

import java.util.List;

import matlap.client.services.task.TaskService;
import matlap.database.dao.DAOFactory;
import matlap.database.dao.TaskDAO;
import matlap.shared.Task;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */

public class TaskServiceImpl extends RemoteServiceServlet implements
		TaskService {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	DAOFactory df = DAOFactory.getInstance();
	TaskDAO td = df.getTaskDAO();

	/**
	 * Inserts task into tasks table by adding Task.
	 */

	public void insertTask1(Task task) {
		td.insertTask(task);
	}

	/**
	 * Turns back Tasks from the task table table in Task list by adding
	 * username.
	 */
	public List<Task> getTaskByUserName(String userName) {
		return td.getTaskByUserName(userName);
	}

	@Override
	public boolean insertTask(Task task) {
		return td.insertTask(task);

	}

	@Override
	public int getTasksNumber() {
		int nr = td.getTasksNumber();
		System.out.println(nr + "taskimpl");
		return td.getTasksNumber();
	}

	@Override
	public List<Task> getTasks() {
		return td.getTasks();
	}

}